package com.lc.zpyh.ui.activity;

import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

import com.hjq.http.EasyHttp;
import com.hjq.http.listener.HttpCallback;
import com.lc.zpyh.R;
import com.lc.zpyh.app.AppActivity;
import com.lc.zpyh.http.request.PublicMsgBean;
import com.lc.zpyh.http.request.UserAgreementsApi;
import com.lc.zpyh.util.SystemUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * author : Android 
 * github : https://github.com/getActivity/AndroidProject
 * time   : 2018/10/18
 * desc   : 关于界面
 */
public final class AboutActivity extends AppActivity {


    @BindView(R.id.tv_version)
    TextView tvVersion;
    @BindView(R.id.tv_v)
    TextView tvV;

    @Override
    protected int getLayoutId() {
        return R.layout.about_activity;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
        tvVersion.setText("当前版本号:"+ SystemUtil.getAppVersionName(this));
        userAgreements();
    }

    private void userAgreements() {
        EasyHttp.post(this)
                .api(new UserAgreementsApi()).request(new HttpCallback<PublicMsgBean>(this) {
            @Override
            public void onSucceed(PublicMsgBean data) {
                if (data.getCode() == 0) {
                    if (data.getList() != null) {
                        tvV.setText(Html.fromHtml(data.getList()));
                    }
                }

            }

            @Override
            public void onFail(Exception e) {
                super.onFail(e);

            }
        });
    }

    @OnClick(R.id.tv_version)
    public void onClick() {
    }
}